package com.estar.integaration.shiro;//package com.smart.smartdustbin.shiro;
//
//import com.smart.smartdustbin.entity.User;
//import com.smart.smartdustbin.service.UserService;
//import org.apache.shiro.authc.*;
//import org.apache.shiro.authz.AuthorizationInfo;
//import org.apache.shiro.realm.AuthorizingRealm;
//import org.apache.shiro.subject.PrincipalCollection;
//import org.springframework.beans.factory.annotation.Autowired;
//
///**
// * Author: YJL
// * Date: 2021/10/14 13:42
// **/
//public class Mauth extends AuthorizingRealm {
//
//  @Autowired
//  private UserService userService;
//
//  /**
//   * 授权
//   * @param authenticationToken
//   * @return
//   * @throws AuthenticationException
//   */
//  @Override
//  protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
//    UsernamePasswordToken token = (UsernamePasswordToken)authenticationToken;
//    User user = userService.findByUserName(token.getUsername());
//    if (user != null ) {
//      return new SimpleAuthenticationInfo(user,user.getPassword(),getName());
//    }
//    return null;
//  }
//
//  /**
//   * 认证
//   * @param principalCollection
//   * @return
//   */
//  @Override
//  protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
//    return null;
//  }
//}
